#include "stdafx.h"
#include "SOCK_Stream.h"
#pragma comment(lib, "Ws2_32.lib")

namespace Network {	
	void SOCK_Stream::SetHandle( HANDLE h )
	{
		handle_ = h;
	}

	HANDLE SOCK_Stream::GetHandle(void)
	{
		return handle_;
	}

	int SOCK_Stream::send(const char* buffer, size_t buffer_size, int flags)
	{
		//fprintf(stdout, "Sending");
		return ::send((SOCKET)handle_,(char *)buffer, buffer_size, flags);
	}
	
	int SOCK_Stream::receive(void* buffer, size_t buffer_size, int flags)
	{
		//fprintf(stdout, "Receiving\n");
		return ::recv((SOCKET)handle_,(char *)buffer, buffer_size, flags);
	}

	void SOCK_Stream::close()
	{
		closesocket((SOCKET)handle_);
	}
}



